import request from '@/utils/request'

export function getClasses(params) {
    return request({
        url: 'api/classes',
        method: 'get',
        params
    })
}

// 一个通用的班级搜索接口，支持按名称、年级、专业搜索和分页
export function searchClasses({ className, grade, major, page, size }) {
    return request({
        url: '/api/classes',
        method: 'get',
        params: {
            className,
            grade,
            major,
            page,
            size
        }
    })
}

// 创建班级
export function createClass(data) {
    return request({
        url: '/api/classes',
        method: 'post',
        data
    })
}

// 更新班级
export function updateClass(id, data) {
    return request({
        url: `/api/classes/${id}`,
        method: 'put',
        data
    })
}

// 删除班级
export function deleteClass(id) {
    return request({
        url: `/api/classes/${id}`,
        method: 'delete'
    })
}